<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
    <th:block th:include="include :: header('运行中的流程列表')"/>
</head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="config-form">
                <div class="select-list">
                    <ul>
                        <li>
                            流程实例ID：<input type="text" name="processInstanceId"/>
                        </li>
                        <li>
<!--                            流程定义Key：<input type="text" name="key"/>-->
                            流程定义key名称：
                            <select name="key" th:with="type=${@dict.getType('act_key')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-success btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-danger btn-del multiple disabled" onclick="$.operate.removeAll()">
                <i class="fa fa-remove"></i> 删除发起的流程实例
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var removeFlag = [[${@permission.hasPermi('activiti:process:remove')}]];
    var prefix = ctx + "activiti/process";
    var data_act_key=[[${@dict.getType('act_key')}]];
    $(function () {
        var options = {
            uniqueId: "processInstanceId",
            url: prefix + "/runningList",
            removeUrl: prefix + "/deleteProcIns",
            modalName: "运行中的流程",
            search: false,
            showExport: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'processInstanceId',
                    align: 'center',
                    title: '流程实例ID'
                },
                {
                    field: 'businessKey',
                    align: 'center',
                    title: '运行流程业务key'
                },
                {
                    field: 'processId',
                    align: 'center',
                    title: '流程定义ID'
                },
                {
                    field: 'key',
                    align: 'center',
                    title: '流程定义Key'
                },
                {
                    field: 'key',
                    align: 'center',
                    title: '流程定义Key名称',
                    formatter: function (value,row,index){
                        return $.table.selectDictLabel(data_act_key,value);
                    }
                },
                {
                    field: 'activitiId',
                    align: 'center',
                    title: '当前待执行环节Key'
                },
                {
                    field: 'startableByUser',
                    align: 'center',
                    title: '流程发起人'
                },
                // 流程实例发起时间
                {
                    field: 'processInstanceStartTime',
                    align: 'center',
                    title: '流程发起时间'
                },
                {
                    field: 'suspended',
                    align: 'center',
                    title: '是否挂起',
                    formatter: function (value, row, index) {
                        return row.suspended ? '是' : '否';
                    }
                },
                {
                    field: 'version',
                    title: '流程版本'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="#" onclick="$.operate.remove(\'' + row.processInstanceId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>